<!doctype html>
<html xmlns:fb="http://www.facebook.com/2008/fbml" xml:lang="en" lang="en">
<head>
	<title><?php echo CHtml::encode($this->pageTitle); ?></title>

	<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
	<meta http-equiv="Content-Language" content="fi-FI" />

	<meta name="description" content="Äänestä ja kommentoi suosikkikuviasi tai osallistu kausittain vaihtuviin kilpailuihin ja voita upeita palkintoja." />

	<link rel="stylesheet" type="text/css" href="<?php echo Yii::app()->request->baseUrl; ?>/css/bootstrap/bootstrap-1.2.0.min.css" media="screen, projection" />
	<link rel="stylesheet" type="text/css" href="<?php echo Yii::app()->request->baseUrl; ?>/css/style.css" />

	<script type="text/javascript" src="<?php echo Yii::app()->request->baseUrl; ?>/js/jquery.bootstraptwipsy.js"></script>
	
	<?php if (ENV_PROD): ?>
		<script type="text/javascript">

			var _gaq = _gaq || [];
			_gaq.push(['_setAccount', 'UA-25649130-1']);
			_gaq.push(['_trackPageview']);

			(function() {
				var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
				ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
				var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
			})();

		</script>
	<?php endif; ?>
</head>

<body>

<div id="fb-root"></div>
<script type="text/javascript" src="http://connect.facebook.net/<?php echo Yii::app()->language !== null ? Yii::app()->language : 'en_US'; ?>/all.js"></script>
<script type="text/javascript">
	FB.init({
		appId: <?php echo Yii::app()->fb->appId; ?>,
		status: true, // check login status
		cookie: true, // enable cookies to allow the server to access the session
		xfbml: true, // parse XFBML
		oauth: true // enable OAuth 2.0
	});
</script>

<div class="topbar">
	<div class="topbar-inner">
		<div class="container clearfix">

			<h3 class="float-left">
				<a href="<?php echo Yii::app()->homeUrl; ?>">Kuvakilpailut.net</a>
			</h3>

			<div class="float-right">
				<?php $this->widget('zii.widgets.CMenu',array(
					'items'=>array(
						array('label'=>Yii::t('frontend','Home'),'url'=>array('/site/index')),
						array('label'=>Yii::t('frontend','Rules'),'url'=>array('/site/page/view/rules'),'active'=>$this->id==='site' && $this->action->id==='page' && $_GET['view']==='rules'),
						array('label'=>Yii::t('frontend','Contact Us'),'url'=>array('/site/contact')),
						array('label'=>Yii::t('frontend','Administration'),'url'=>array('/admin'),'active'=>$this->module!==null && $this->module->id==='admin','visible'=>Yii::app()->user->isAdmin),
						array('label'=>Yii::t('frontend','Login'),'url'=>array('/site/login'),'visible'=>Yii::app()->user->isGuest),
						array('label'=>Yii::t('frontend','Logout (:name)',array(':name'=>Yii::app()->user->name)),'url'=>array('/site/logout'),'visible'=>!Yii::app()->user->isGuest),
						array('label'=>Yii::t('frontend','Register'),'url'=>array('/user/register'),'visible'=>Yii::app()->user->isGuest),
					),
					'htmlOptions'=>array('class'=>'nav'),
				)); ?>
			</div>

		</div>
	</div>
</div> <!-- .topbar -->

<div id="page" class="container">

	<?php /*if (Yii::app()->user->isGuest): ?>
		<div id="facebookConnect" class="clearfix">
			<div class="disclaimer float-left">
				<?php echo Yii::t('frontend','Connect to Facebook in order to vote, comment and take part in contests. <strong>Activity on this website will not be posted to your wall unless you "Recommend" it.</strong> Please also notice that your Facebook users details will not be displayed to other users.'); ?>
			</div>
			<div class="connect float-right">
				<fb:login-button scope="email" size="large" onlogin="window.location.reload();"><?php echo Yii::t('frontend','Connect to Facebook'); ?></fb:login-button>
			</div>
		</div> <!-- #facebookConnect -->
	<?php endif;*/ ?>

	<div id="breadcrumbs">
		<?php if(isset($this->breadcrumbs)):?>
			<?php $this->widget('zii.widgets.CBreadcrumbs', array(
				'links'=>$this->breadcrumbs,
				'separator'=>'&nbsp;&nbsp;&rsaquo;&nbsp;&nbsp;',
			)); ?>
		<?php endif?>
	</div> <!-- #breadcrumbs -->

	<?php echo $content; ?>

	<div id="footer">
		<?php echo Yii::t('frontend','&copy; :year Kuvakilpailut.net. All Rights Reserved.',array(':year'=>date('Y'))); ?>
	</div><!-- #footer -->

</div><!-- #page -->

<?php $this->widget('ext.flashmessage.FlashMessage', array(
	'keys'=>array('success','info','warning','error'),
	'template'=>'<div class="alert-message {key}"><div class="container">{message}</div></div>',
	'htmlOptions'=>array('class'=>'flash'),
)); ?><!-- flashes -->

<?php Yii::app()->clientScript->registerScript('bootstraptwipsy',"
	$('.twipsify').bootstraptwipsy();
"); ?>

</body>
</html>